import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import '../../../../resource/language/generated/l10n.dart';

class UserListItemAdminWidget extends StatefulWidget {
  // final SimpleChannelUser user;
  final VoidCallback? onPressed;
  final VoidCallback? onPressedRightBtn;
  final int index;
  // final RtcUserRole? myRole;

  const UserListItemAdminWidget(
      {Key? key,
      // required this.user,
      // required this.myRole,
      required this.index,
      this.onPressed,
      this.onPressedRightBtn})
      : super(key: key);

  @override
  State<UserListItemAdminWidget> createState() =>
      _UserListItemAdminWidgetState();
}

class _UserListItemAdminWidgetState extends State<UserListItemAdminWidget> {
  @override
  Widget build(BuildContext context) {
    return CupertinoButton(
      onPressed: () {
        widget.onPressed?.call();
      },
      minSize: 0,
      padding: EdgeInsets.zero,
      child: Container(
        decoration: const BoxDecoration(
          color: Colors.white,
        ),
        padding: const EdgeInsets.only(left: 22, right: 20, top: 20),
        height: 72,
        child: Row(
          children: [
            Text(
              "${widget.index}",
              style: const TextStyle(
                  fontSize: 20,
                  color: Color(0xFF9F9F9F),
                  fontWeight: FontWeight.w600,
                  height: 1),
            ),
            const SizedBox(
              width: 20,
            ),
            // AvatarImage(
            //     url: widget.user.avatar,
            //     width: 42,
            //     height: 42,
            //     borderRadius: 21),
            const SizedBox(
              width: 12,
            ),
            // Expanded(
            //   child: Column(
            //       mainAxisSize: MainAxisSize.min,
            //       crossAxisAlignment: CrossAxisAlignment.start,
            //       children: [
            //         Row(
            //           mainAxisSize: MainAxisSize.min,
            //           children: [
            //             Text(
            //               widget.user.nickname,
            //               style: const TextStyle(
            //                   fontSize: 13,
            //                   color: Color(0xff333333),
            //                   fontWeight: FontWeight.w500,
            //                   height: 1),
            //             ),
            //             const SizedBox(
            //               width: 4,
            //             ),
            //             SexAgeLabel(
            //               isMale: widget.user.gender == UserConstants.genderMan,
            //               age: widget.user.age.toString(),
            //             )
            //           ],
            //         ),
            //         const SizedBox(
            //           height: 4,
            //         ),
            //         Row(
            //           mainAxisSize: MainAxisSize.min,
            //           children: [
            //             Container(
            //               padding:
            //                   EdgeInsets.symmetric(horizontal: 5, vertical: 2),
            //               decoration: BoxDecoration(
            //                 color: Color(0xFFFCE7BC),
            //                 borderRadius: BorderRadius.circular(9),
            //               ),
            //               child: Text(
            //                 widget.user.role == RtcUserRole.Owner
            //                     ? T.current!.homeowner
            //                     : (widget.user.role == RtcUserRole.Receptionist
            //                         ? T.current!.receptionist
            //                         : (widget.user.role == RtcUserRole.Manager
            //                             ? T.current!.admin
            //                             : "")),
            //                 style: TextStyle(
            //                     fontSize: 8,
            //                     color: Color(0xFF7A542F),
            //                     fontWeight: FontWeight.w500),
            //               ),
            //             ),
            //           ],
            //         )
            //       ]),
            // ),

            // if ((widget.user.id.toInt() !=
            //         UserManager.instance.currentUser?.id.toInt()) &&
            //     (widget.myRole?.value ?? 0) > widget.user.role.value)

            CupertinoButton(
              onPressed: () {
                widget.onPressedRightBtn?.call();
              },
              minSize: 0,
              padding: EdgeInsets.zero,
              child: Container(
                padding: const EdgeInsets.symmetric(horizontal: 11),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(14),
                    color: const Color(0xffffd400)),
                height: 28,
                alignment: Alignment.center,
                child: Text(
                  T.current.cancel_manager,
                  style: const TextStyle(
                      fontSize: 11,
                      fontWeight: FontWeight.w500,
                      color: Color(0xff333333)),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
